/**
 * UIObject.as
 * Andy Jiang   
 * Fusion Digital Shanghai Co,Ltd. All Rights Reserved.
 * version 0.1
 * 
 */ 

package jiezi.ui 
{
	import flash.events.Event;
	import flash.text.TextField;
	/**
	 * ...
	 * @author andy
	 */
	
	public class ScrollingMessageFrame extends Frame implements FontInstance
	{
		private var mTextField:TextField;
		
		public static function creator(name:String):Frame
		{
			return new ScrollingMessageFrame(name)
		}
		public function ScrollingMessageFrame(name:String) 
		{
			super(name)
			addEventListener(RESIZE, this.onResized)
			mTextField = new TextField;
			sprite.addChild(mTextField)
		}
		
		protected function onResized(event:Event):void
		{
			mTextField.width = width;
			mTextField.height = height;
		}
		
		public function setJustifyH( justifyH:String ):void
		{
			
		}
		
		public function setJustifyV( justifyV:String ):void
		{
			
		}
		
		public function addMessage(text:String, r:Number = 1.0, g:Number = 1.0, b:Number = 1.0):void
		{
			mTextField.appendText( text + "\n" )
		}
		
		public function ScrollToBottom():void
		{
			mTextField.scrollV = mTextField.maxScrollV			
		}
		
		public function ScrollToTop():void
		{
			mTextField.scrollV = 0			
		}
		
	}

}